<script setup lang="ts">
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'
// 获取DOM节点
const charts = ref()
// 组件挂载完毕
onMounted(() => {
  // 一个容器可以同时展示多种类型的图形图标
  echarts.init(charts.value).setOption({
    title: {
      text: '年度数据',
      left: '40%',
      textStyle: {
        color: 'black',
      },
    },
    xAxis: {
      type: 'category',
      show: true,
    },
    yAxis: {
      show: false,
    },
    grid: {
      left: 10,
      right: 0,
      top: 0,
      bottom: 20,
    },
    series: {
      type: 'scatter',
      data: [33, 88, 21, 9, 788, 234, 1213, 1231, 674, 3, 22, 39],
      symbol: 'arrow',
      symbolSize: 16,
      label: {
        show: true,
        position: 'top',
        color: 'yellowgreen',
      },
      // 散点图标记的颜色
      itemStyle: {
        color: 'cyan',
      },
    },
  })
})
</script>

<template>
  <div class="box7">
    <div class="title">
      <p>年度数据</p>
      <img src="../../images/dataScreen-title.png" />
    </div>
    <div class="charts" ref="charts"></div>
  </div>
</template>

<style scoped lang="scss">
.box7 {
  width: 100%;
  height: 100%;
  background: url(../../images/dataScreen-main-rc.png) no-repeat;
  background-size: 100% 100%;
  margin-top: 10px;

  .title {
    margin-left: 5px;

    p {
      color: white;
      font-size: 20px;
    }
  }

  .charts {
    height: calc(100% - 30px);
  }
}
</style>
